home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1999 Spring / macformat-077.iso / Shareware Plus / Development / Akua Sweets 131 / Akua Sweets Examples / Imaging / Rotation < prev    next >
Encoding:
Text File  |  1999-03-04  |  1.2 KB  |  64 lines  |  [TEXT/ToyS]

  1. property gasWin : 0
  2. property gasLoc : {40, 60}
  3.  
  4. global gasPic
  5. global gasRot, gasCent
  6.  
  7.  
  8. on run
  9.     open (choose file)
  10. end run
  11.  
  12.  
  13. on open fsObj
  14.     set gasWin to display drawing titled ¬
  15.         "Wheeee!" located at gasLoc ¬
  16.         starting with (the image from fsObj)
  17.     
  18.     set gasPic to capture picture from gasWin
  19.     set gasRot to 0
  20.     
  21.     set dims to window dimensions of gasWin
  22.     display drawing gasWin with disposal
  23.     
  24.     set x to item 1 of dims
  25.     set y to item 2 of dims
  26.     
  27.     if (x > y) then
  28.         set y to x
  29.     else
  30.         set x to y
  31.     end if
  32.     
  33.     set gasWin to display drawing titled ¬
  34.         "Wheeee!" located at gasLoc ¬
  35.         with dimensions {x, y}
  36.     
  37.     draw a box into gasWin ¬
  38.         inside of {0, 0, x, y} ¬
  39.         filling it with the pen
  40.     
  41.     set gasCent to {x div 2, y div 2}
  42. end open
  43.  
  44.  
  45. on idle
  46.     set cg to conglomerate of (input state)
  47.     repeat while (conglomerate of (input state) is cg)
  48.         set gasRot to gasRot + 36
  49.         draw a picture into gasWin using data (rotate image gasPic by gasRot) ¬
  50.             offset by gasCent justified flush dead center without recording
  51.     end repeat
  52.     
  53.     set gasRot to gasRot mod 3600
  54.     
  55.     return 2
  56. end idle
  57.  
  58.  
  59. on quit
  60.     set gasPic to 0
  61.     set gasLoc to screen location of (display drawing gasWin with disposal)
  62.     continue quit
  63. end quit
  64.